using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace RideMe.CommandManagement
{
    public class ToolbarCommandExecutor : CommandExecutor
    {
        public override void InstanceAdded(object sender, Command command)
        {
            ToolStripButton toolStripButton = (ToolStripButton)sender;
            toolStripButton.Click += new EventHandler(toolStripButton_Click);

            base.InstanceAdded(sender, command);
        }

        private void toolStripButton_Click(object sender, EventArgs e)
        {
            Command command = GetCommandForInstance(sender);
            command.OnExecute(EventArgs.Empty);
        }

        public override void Enable(object sender, bool enable)
        {
            ToolStripButton button = (ToolStripButton)sender;
            button.Enabled = enable;
        }

        public override void Check(object sender, bool check)
        {
        }


    }
}
